<?php

namespace app\api\behavior\order;

use app\api\model\Course;
use app\api\model\CourseOrder;
use app\api\service\OrderRemindService;
use think\Db;

class AutoCancel
{
    protected $model;

    public function run($model)
    {
        $this->model = $model;
        //自动取消
        $this->close();
        return true;
    }

    /**
     * 自动取消
     */
    public function close()
    {
        $remindTime = config('setting.order')['cancel_time'];
        if (!$remindTime) {
            return false;
        }
        $time = time() - $remindTime;
        OrderRemindService::autoCancel($time);
        return true;
    }
}